export default {
  install(Vue) {
    Vue.prototype.setWaterMark = function (watermark_txt) {
        this.$watermark.watermark.load({
          watermark_txt: watermark_txt, //水印的内容
          watermark_color: "grey", //水印字体颜色
          watermark_fontsize: "16px", //水印字体大小
          watermark_alpha: 0.2, //水印透明度，要求设置在大于等于0.005
          watermark_angle: 25, //水印倾斜度数
          watermark_parent_node: "main",
          watermark_width: 200, //水印宽度
          watermark_height: 100,
          watermark_x: 20, //水印起始位置x轴坐标
          watermark_y: 30,
        });
      },
      Vue.prototype.backToHome = function() {
        this.$router.push("/HomePage");
      },
      Vue.prototype.getNowFormatDate = function(date) {
        let
          year = date.getFullYear(), //获取完整的年份(4位)
          month = date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
            strDate = date.getDate() // 获取当前日(1-31)
        if (month < 10) month = `0${month}` // 如果月份是个位数，在前面补0
        if (strDate < 10) strDate = `0${strDate}` // 如果日是个位数，在前面补0
        return `${year}-${month}-${strDate}`
      },
        Vue.prototype.getMonthBeforeDate = function() {
          var dateTime = new Date();
          dateTime = dateTime.setMonth(dateTime.getMonth() - 1);
          return new Date(dateTime);
        },
        Vue.prototype.getYearBeforeDate = function() {
          var dateTime = new Date();
          dateTime = dateTime.setFullYear(dateTime.getFullYear() - 1);
          return new Date(dateTime);
        },
      Vue.prototype.getMonthAfterDate = function() {
        var dateTime = new Date();
        dateTime = dateTime.setMonth(dateTime.getMonth() + 1);
        return new Date(dateTime);
      },      
      Vue.prototype.setPostDate = function() {
        this.showCalendar = true;
      }
  }
}